package com.hmy.finance.dal.po;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.hmy.finance.dal.po.json.*;
import com.hmy.finance.service.statement.dto.DeviceStatementLossInfoDto;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 设备子对账单
 */
@TableName(value = "reconciliation_device_statement", autoResultMap = true)
@Data
public class ReconciliationDeviceStatementPo implements Serializable {
    @TableField(exist = false)
    private static final long serialVersionUID = -2136893218895767992L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @TableField(value = "reconciliation_statement_id")
    private Long reconciliationStatementId;

    @TableField(value = "reconciliation_contract_statement_id")
    private Long reconciliationContractStatementId;

    @TableField(value = "customer_id")
    private Long customerId;

    @TableField(value = "signatory_id")
    private Long signatoryId;

    @TableField(value = "device_rental_record_id")
    private Long deviceRentalRecordId;

    @TableField(value = "contract_id")
    private Long contractId;

    @TableField(value = "contract_no")
    private String contractNo;

    @TableField(value = "device_model")
    private String deviceModel;

    @TableField(value = "device_id")
    private Long deviceId;

    @TableField(value = "device_no")
    private String deviceNo;

    @TableField(value = "rental_start_time")
    private LocalDateTime rentalStartTime;

    @TableField(value = "rental_end_time")
    private LocalDateTime rentalEndTime;

    @TableField(value = "total_days")
    private Integer totalDays;

    @TableField(value = "rental_days")
    private Double rentalDays;

    @TableField(value = "rental_unit_price")
    private BigDecimal rentalUnitPrice;

    @TableField(value = "entry_fee")
    private BigDecimal entryFee;

    @TableField(value = "exit_fee")
    private BigDecimal exitFee;

    @TableField(value = "claim_payable")
    private BigDecimal claimPayable;

    @TableField(value = "modification_payable")
    private BigDecimal modificationPayable;

    @TableField(value = "total_amount")
    private BigDecimal totalAmount;

    @TableField(value = "rent_payable")
    private BigDecimal rentPayable;

    @TableField(value = "device_loss_infos", typeHandler = DeviceStatementLossInfoJsonHandler.class)
    private List<DeviceStatementLossInfoJson> deviceLossInfos;

//    @TableField(value = "reconciliation_subtotal", typeHandler = JacksonTypeHandler.class)
//    private String reconciliationSubtotal;

    @TableField(value = "reconciliation_adjust", typeHandler = JacksonTypeHandler.class)
    private ReconciliationAdjustJson reconciliationAdjust;

    @TableField(value = "contract_extension", typeHandler = JacksonTypeHandler.class)
    private ContractExtensionInfoJson contractExtension;

    @TableField(value = "customer_extension", typeHandler = JacksonTypeHandler.class)
    private CustomerExtensionInfoJson customerExtension;

    @TableField(value = "reconciliation_date", fill = FieldFill.INSERT)
    private LocalDateTime reconciliationDate;

//    @TableField(value = "status", typeHandler = EnumTypeHandler.class)
//    private StatementStatusEnum status;

    @TableField(value = "is_deleted")
    @TableLogic
    private Integer isDeleted;

    @TableField(value = "create_time")
    private LocalDateTime createTime;

    @TableField(value = "creator_id")
    private Long creatorId;

    @TableField(value = "creator_name")
    private String creatorName;

    @TableField(value = "update_time")
    private LocalDateTime updateTime;

    @TableField(value = "updater_id")
    private Long updaterId;

    @TableField(value = "updater_name")
    private String updaterName;
}